package com.zzz.demo01;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author zhuzhizun
 * @date 2021/7/19
 */
public class StreamTest {
    public static void main(String[] args) {
        List<Integer> numbers = Arrays.asList(3, 2, 2, 3, 7, 3, 5);
        // 获取对应的平方数
        List<Integer> squaresList = numbers
                .stream()
                .map(i -> i * i)
                .distinct()
                .collect(Collectors.toList());

        squaresList.forEach(v -> System.out.println(v));

    }
}
